<html>
<head><meta charset="utf-8"><title>rustc log flow visualization · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rustc.20log.20flow.20visualization.html">rustc log flow visualization</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="223793913"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/rustc%20log%20flow%20visualization/near/223793913" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rustc.20log.20flow.20visualization.html#223793913">(Jan 24 2021 at 03:53)</a>:</h4>
<p>How does rustc generate the log output that looks like this?</p>
<div class="codehilite"><pre><span></span><code>│ │ ├─0ms DEBUG rustc_trait_selection::traits::project result=&lt;&amp;mut _ as std::ops::CoerceUnsized&lt;&amp;_&gt;&gt;, obligations.len=0
│ │ ├─0ms DEBUG rustc_trait_selection::traits::project normalizer.obligations=[]
│ │┌┘rustc_trait_selection::traits::project::normalize_with_depth_to depth=1, value=&lt;&amp;mut _ as std::ops::CoerceUnsized&lt;&amp;_&gt;&gt;
│ ├┘rustc_trait_selection::traits::select::candidate_assembly::candidate_from_obligation stack=TraitObligationStack(Obligation(predicate=Binder(TraitPredicate(&lt;() as std::ops::CoerceUnsized&lt;_&gt;&gt;)), depth=0))
</code></pre></div>
<p>I know rustc uses <code>tracing</code>, but I couldn't figure out what to search for to find out how to do it in <code>tracing</code>, or whatever library that rustc uses.</p>



<a name="223794641"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/rustc%20log%20flow%20visualization/near/223794641" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rustc.20log.20flow.20visualization.html#223794641">(Jan 24 2021 at 04:15)</a>:</h4>
<p>I think <span class="user-mention" data-user-id="124288">@oli</span> is the one who set that up</p>



<a name="223795890"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/rustc%20log%20flow%20visualization/near/223795890" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rustc.20log.20flow.20visualization.html#223795890">(Jan 24 2021 at 04:50)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/26c2d1f408bc1b107cbc23df5f83d23208fc1c2e/compiler/rustc_driver/src/lib.rs#L1270">https://github.com/rust-lang/rust/blob/26c2d1f408bc1b107cbc23df5f83d23208fc1c2e/compiler/rustc_driver/src/lib.rs#L1270</a></p>



<a name="223795895"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/rustc%20log%20flow%20visualization/near/223795895" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rustc.20log.20flow.20visualization.html#223795895">(Jan 24 2021 at 04:51)</a>:</h4>
<p>Specifically that <code>set_global_default</code> call</p>



<a name="223812550"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/rustc%20log%20flow%20visualization/near/223812550" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rustc.20log.20flow.20visualization.html#223812550">(Jan 24 2021 at 12:53)</a>:</h4>
<p><span class="user-mention" data-user-id="232957">@Jack Huey</span> why does it show the tree for rustc_trait_selection but not rustdoc logging? The question is how to get the nesting, rustdoc calls that same init function.</p>



<a name="223822058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/rustc%20log%20flow%20visualization/near/223822058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rustc.20log.20flow.20visualization.html#223822058">(Jan 24 2021 at 16:33)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span>  Those would be either the instrument proc macros or a span</p>



<a name="223843049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/rustc%20log%20flow%20visualization/near/223843049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rustc.20log.20flow.20visualization.html#223843049">(Jan 24 2021 at 23:48)</a>:</h4>
<p>Is it provided by <code>tracing-tree</code>?</p>



<a name="223843095"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/rustc%20log%20flow%20visualization/near/223843095" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rustc.20log.20flow.20visualization.html#223843095">(Jan 24 2021 at 23:48)</a>:</h4>
<p>It seems like this <em>might</em> be where that feature is enabled: <a href="https://github.com/rust-lang/rust/blob/26c2d1f408bc1b107cbc23df5f83d23208fc1c2e/compiler/rustc_driver/src/lib.rs#L1297-L1305">https://github.com/rust-lang/rust/blob/26c2d1f408bc1b107cbc23df5f83d23208fc1c2e/compiler/rustc_driver/src/lib.rs#L1297-L1305</a></p>



<a name="223843118"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/rustc%20log%20flow%20visualization/near/223843118" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rustc.20log.20flow.20visualization.html#223843118">(Jan 24 2021 at 23:49)</a>:</h4>
<p>Yeah, it looks like <code>tracing-tree</code> is responsible.</p>



<a name="223843120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/rustc%20log%20flow%20visualization/near/223843120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rustc.20log.20flow.20visualization.html#223843120">(Jan 24 2021 at 23:49)</a>:</h4>
<p>Thanks for your help!</p>



<a name="223866008"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/rustc%20log%20flow%20visualization/near/223866008" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rustc.20log.20flow.20visualization.html#223866008">(Jan 25 2021 at 08:16)</a>:</h4>
<p>Ideally you would invoke <code>rustc_driver::init_env_logger("RUSTDOC_LOG")</code> instead of duplicating the code</p>



<a name="223908663"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/rustc%20log%20flow%20visualization/near/223908663" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rustc.20log.20flow.20visualization.html#223908663">(Jan 25 2021 at 15:02)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> we do: <a href="https://github.com/rust-lang/rust/blob/d3163e96553ae8cb1fca0e62084b124e8b98310b/src/librustdoc/lib.rs#L98">https://github.com/rust-lang/rust/blob/d3163e96553ae8cb1fca0e62084b124e8b98310b/src/librustdoc/lib.rs#L98</a></p>



<a name="223909088"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/rustc%20log%20flow%20visualization/near/223909088" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rustc.20log.20flow.20visualization.html#223909088">(Jan 25 2021 at 15:05)</a>:</h4>
<p>Well, I might hack around it for <a href="https://github.com/rust-lang/rust/pull/79540#issuecomment-751478610">https://github.com/rust-lang/rust/pull/79540#issuecomment-751478610</a>. But I'd prefer to reuse the code if possible.</p>



<a name="223909361"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/rustc%20log%20flow%20visualization/near/223909361" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rustc.20log.20flow.20visualization.html#223909361">(Jan 25 2021 at 15:07)</a>:</h4>
<p><a href="https://github.com/jyn514/rust/commit/6a5d5124209bec7652e745725a995bd77bb3f881">https://github.com/jyn514/rust/commit/6a5d5124209bec7652e745725a995bd77bb3f881</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>